Brief Full Advanced Search Search Tips
|  |  | To access the contents, click the chapter and section titles. Visual Basic 6 Programming Blue Book: The Most Complete, Hands-On Resource for Writing Programs with Microsoft Visual Basic 6! (Publisher: The Coriolis Group) Author(s): Peter G. Aitken ISBN: 1576102815 Publication Date: 08/01/98 Search this book:
Previous | Table of Contents | Next
Internet Transfer Control Properties I have mentioned some of the Internet Transfer control properties. You can get a lot of use out of the control without worrying about most of its properties. For special situations, however, you may need to change some of them from their default values. I have not listed the standard control properties, such as Name and Index, but only those specific to this control. AccessType determines how the control accesses the Internet. The possible settings are: • icUseDefault (value = 0)—The control uses the default access settings found in the registry to access the Internet. This is the default property setting. • icDirect (value = 1)—The control has a direct connection to the Internet. • icNamedProxy (value = 2)—The control uses the proxy server specified in the Proxy property. Document specifies the name of the file that will be used with the Execute method if a document is not specified in the method’s arguments. If this property is left blank, the server’s default document is returned, or for write operations, an error occurs. Password specifies the password used when the control is logging onto a remote server. Protocol specifies the Internet protocol that will be used with the Execute method. The possible settings are shown in Table 18.4. The setting of this property interacts with the protocol, if any, included in the URL used with the OpenURL and Execute methods, and also with the URL property. If, for example, you call Execute and specify a URL, such as http://www.microsoft.com, then this property updates to reflect the HTTP protocol. Table 18.4 Valid settings for the Internet Transfer control’s Protocol property.
Constant | Value | Protocol
--- | --- | ---
IcUnknown | 0 | Unknown.
IcDefault | 1 | Default protocol.
IcFTP | 2 | File Transfer Protocol.
IcReserved | 3 | Reserved for future use.
IcHTTP | 4 | Hypertext Transfer Protocol.
IcHTTPS | 5 | Secure HTTP.
Proxy specifies the name of the proxy server used to communicate with the Internet. This property is used only if the AccessType property is set to icNamedProxy. RequestTimeout specifies the amount of time (in seconds) to wait for a response to a request before a time-out expires. If no response occurs within the specified time, and if the request was made with the OpenURL method (synchronous), an error is generated. If the request was made with the Execute method, the StateChanged event will occur with an error code. Set this property to zero to disable time-outs (the control will wait as long as needed). ResponseCode returns the error code from when the StateChanged event occurs with the icError argument. ResponseInfo provides a text description of the most recent error that occurred. StillExecuting returns True if the control is busy; otherwise, False. URL specifies the URL, including protocol, that is used by the Execute or OpenURL methods. If a URL is specified as a method argument, this property is updated to reflect that URL. Username specifies the user name that will be sent as a logon to remote computers. If this property is blank, then “anonymous” is sent. ### The WebBrowser Control The WebBrowser control lets you drop a fully functional Web browser onto a Visual Basic form. It has all the capabilities required to view, navigate, and process HTML pages. In fact, it is the same ActiveX component used in Microsoft’s Internet Explorer browser. Perhaps referring to this control as a partially functional Web browser would be more accurate, because it does not have its own menus, toolbar, or other elements that you are used to seeing in a standalone browser application. These elements—or whatever user interface components your application needs—must be provided as part of the Visual Basic program. Code in your program manipulates the WebBrowser control by means of its properties and methods. This enables the programmer to provide just the Web functionality that is desired. For example, you could write a browser that permits the user to access only pages on your company’s own Web pages, preventing them from wasting time at other sites. The WebBrowser control is fairly easy to use. Basic operation can be achieved with very few program statements. For example, to view a particular Web page, all that is required is to place a WebBrowser control on a form and then place the following line of code in the form’s Load event procedure (assuming the control’s name is WB1):
    WB1.Navigate “<www.wherever.com>”
Figure 18.3 shows The Coriolis Group’s Web page displayed in a WebBrowser control. Once a page is displayed, the user can access all of the navigation and other features provided as part of the page. Other capabilities—for example, a Back button—must be implemented by the programmer. For details on the WebBrowser control’s methods and properties, refer to the Visual Basic online Help system. Space limitations prevent me from giving it a full treatment. WebBrowser is a powerful component and should be all you ever need if you want to incorporate Web-browsing capabilities in your Visual Basic applications. Figure 18.3 Using the WebBrowser control to view Web pages.
Previous | Table of Contents | Next

| Products | Contact Us | About Us | Privacy | Ad Info | Home Use of this site is subject to certain Terms & Conditions, Copyright © 1996-2000 EarthWeb Inc. All rights reserved. Reproduction whole or in part in any form or medium without express written permission of EarthWeb is prohibited. Read EarthWeb's privacy statement.